package com.zbkj.crmeb.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 品牌类型
 * @Description: 
 * @author daigb
 * @date 2021-04-13
 */
public enum CouponUseTypeEnum implements IEnum<Integer> {
    /**
     * 全场通用
     */
    ALL_GOODS(1, "全场通用"),
    
    /**
     * 商品券
     */
    GOODS(2, "商品券"),
    
    /**
     * 品类券
     */
    CATE(3, "品类券")
    ;

    private final Integer code;
    private final String msg;

    CouponUseTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static CouponUseTypeEnum valueOf(Integer code) {
        for (CouponUseTypeEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return CouponUseTypeEnum.ALL_GOODS;
    }

    @Override
    @JsonValue
    public Integer getValue() {
        return code;
    }

}

